﻿{% extends "gma/base.html" %}
{% load mytag %}

<!-- CONTENT
  =====================================================================-->

{% block content %}

<div class="page__bd">
    <div class="weui-cells__title">被举报对象信息</div>
    <div class="weui-cells">
        <a class="weui-cell weui-cell_access" href="{% url 'gma:caster_detail' log.target_uid %}">
            <div class="weui-cell__bd"> <p>被举报对象</p> </div>
            <div class="weui-cell__ft"> <img src="{{ log.avatar|cdn }}" class="right_large_avatar"> </div>
        </a>

        <div class="weui-cell">
            <div class="weui-cell__bd"> <p>用户id</p> </div>
            <div class="weui-cell__ft">{{ log.target_uid }}</div>
        </div>

        <div class="weui-cell">
            <div class="weui-cell__bd"> <p>昵称</p> </div>
            <div class="weui-cell__ft">{{ log.nickname }}</div>
        </div>
    </div>

{#    <div class="weui-cells__title">举报者信息</div>#}
{#    <div class="weui-cells">#}
{#        <div class="weui-cell">#}
{#            <div class="weui-cell__bd"> <p>用户id</p> </div>#}
{#            <div class="weui-cell__ft">{{ reporter.id }}</div>#}
{#        </div>#}
{##}
{#        <div class="weui-cell">#}
{#            <div class="weui-cell__bd"> <p>昵称</p> </div>#}
{#            <div class="weui-cell__ft">{{ reporter.nickname }}</div>#}
{#        </div>#}
{#    </div>#}

    <div class="weui-cells__title">举报内容</div>
    <div class="weui-cells">
        <div class="weui-cell">
            <div class="weui-cell__bd"> <p>ID</p> </div>
            <div class="weui-cell__ft">{{ log.cid }}</div>
        </div>

        <div class="weui-cell">
            <div class="weui-cell__bd"> <p>标题</p> </div>
            <div class="weui-cell__ft">{{ log.title }}</div>
        </div>

        <div class="weui-cell">
            <div class="weui-cell__bd"> <p>举报时间</p> </div>
            <div class="weui-cell__ft">{{ log.create_time|date:"Y-m-d H:i:s" }}</div>
        </div>

        <a class="weui-cell weui-cell_access" href="{% url 'gma:caster_detail' reporter.uid %}">
            <div class="weui-cell__bd"> <p>举报者</p> </div>
            <div class="weui-cell__ft"> <img src="{{ reporter.avatar|cdn }}" class="right_large_avatar"> </div>
        </a>

        <div class="weui-cell">
            <div class="weui-cell__bd"> <p>描述</p> </div>
            <div class="weui-cell__ft">{{ log.desp }}</div>
        </div>

        <a class="weui-cell weui-cell_access" href="{% url 'gma:gallery' log.image_url|cdn %}">
            <div class="weui-cell__bd">
                <p>图片</p>
            </div>
            <div class="weui-cell__ft"><img src="{{ log.image_url|cdn }}" class="right_large_avatar"></div>
        </a>
    </div>
</div>

{% if permissions.complaint_management.open %}
<div class="weui-btn-area">
    {% if log.auth_status == 1 %}
        <a class="weui-btn weui-btn_block weui-btn_primary" href="javascript:agreeComplaint()"> <i class="fa fa-check"></i> 接受举报 </a>
        <a class="weui-btn weui-btn_block weui-btn_warn" href="javascript:rejectComplaint()"> <i class="fa fa-times"></i> 拒绝举报 </a>
    {% endif %}
</div>
{% endif %}


<div class="page__ft">
    <a href="{% url 'gma:home' %}">
        <span class="bottom-logo">
           HiBao
       </span>
    </a>
</div>


{% endblock content %}

<!-- SCRIPT
  =====================================================================-->

{% block extra_js %}
<script>

function agreeComplaint() {
    let url = "{% url 'gma:api_agree_complaint' %}";
    let data = {
        'cid': {{ log.cid }}
    };

    new my_ajax(url, data, '', '', () => {
        show_toast(`接受举报!`);
        setTimeout(() => {
            window.location.reload();
        }, 1000);
    });
}

function rejectComplaint() {
    let url = "{% url 'gma:api_reject_complaint' %}";
    let data = {
        'cid': {{ log.cid }}
    };

    new my_ajax(url, data, '', '', () => {
        show_toast(`拒绝举报!`);
        setTimeout(() => {
            window.location.reload();
        }, 1000);
    });
}

</script>

{% endblock extra_js %}